import { createRouter, createWebHistory } from 'vue-router'

export const routes = [
	{
		path: '/',
		redirect: '/controls1',
		meta: {
			title: 'OpenLayers 入门'
		},
		children: [
			{
				path: '/demo1',
				name: 'Demo1',
				meta: {
					title: 'OpenLayers 开发环境搭建'
				},
				component: () => import('../views/demo1/index.vue')
			},
			{
				path: '/demo2',
				name: 'Demo2',
				meta: {
					title: 'OpenLayers 地图投影转换'
				},
				component: () => import('../views/demo2/index.vue')
			},
			{
				path: '/demo3',
				name: 'Demo3',
				meta: {
					title: 'OpenLayers 创建坐标系统'
				},
				component: () => import('../views/demo3/index.vue')
			}
		]
	},
	{
		path: '/controls',
		redirect: '/controls1',
		meta: {
			title: 'OpenLayers 加载地图控件'
		},
		children: [
			{
				path: '/controls1',
				name: 'Controls1',
				meta: {
					title: 'OpenLayers 开发环境搭建'
				},
				component: () => import('../views/controls/demo1/index.vue')
			},
		]
	},
]

const router = createRouter({
	history: createWebHistory(),
	routes
})

export default router